package com.sm.honkon.ui.model

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.sm.honkon.app.App
import com.sm.honkon.data.bean.ControlLogCatEntity
import com.sm.honkon.data.bean.CustomerEntity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

class ControlLogCatViewModel : BaseViewModel() {
    val customerDao = App.database.customerDao()
    val logcatDao = App.database.logcatDao()
    var user: LiveData<CustomerEntity> = MutableLiveData<CustomerEntity>()
    var logcat: LiveData<List<ControlLogCatEntity>> = MutableLiveData<List<ControlLogCatEntity>>()
    val shouzhen = arrayListOf("黄褐斑", "太田痣", "痤疮", "纹身", "雀斑", "老年斑", "嫩肤")
    fun insertUser() {
        viewModelScope.launch(Dispatchers.IO) {
            user.value?.let {
                customerDao.update(it)
            }
        }
    }
}